<code class="prism  language-python"><span class="token comment">#绘制移动平均线</span>

df_stockload<span class="token punctuation">.</span>Close<span class="token punctuation">.</span>plot<span class="token punctuation">(</span>c<span class="token operator">=</span><span class="token string">'b'</span><span class="token punctuation">)</span>

df_stockload<span class="token punctuation">.</span>Close<span class="token punctuation">.</span>rolling<span class="token punctuation">(</span>window<span class="token operator">=</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">.</span>mean<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>plot<span class="token punctuation">(</span>c<span class="token operator">=</span><span class="token string">'r'</span><span class="token punctuation">)</span> <span class="token comment">#pd.rolling_mean(df_stockload.Close,window=30).plot(c='r')</span>

df_stockload<span class="token punctuation">.</span>Close<span class="token punctuation">.</span>rolling<span class="token punctuation">(</span>window<span class="token operator">=</span><span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">.</span>mean<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>plot<span class="token punctuation">(</span>c<span class="token operator">=</span><span class="token string">'g'</span><span class="token punctuation">)</span> <span class="token comment">#pd.rolling_mean(df_stockload.Close,window=60).plot(c='g')</span>

plt<span class="token punctuation">.</span>legend<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">'Close'</span><span class="token punctuation">,</span><span class="token string">'30ave'</span><span class="token punctuation">,</span><span class="token string">'60ave'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>loc<span class="token operator">=</span><span class="token string">'best'</span><span class="token punctuation">)</span>

plt<span class="token punctuation">.</span>show<span class="token punctuation">(</span><span class="token punctuation">)</span>
</code>